/**
 * 
 */
package org.jfarrell.classes;

import java.io.Serializable;
import java.awt.Point;
import javax.swing.ImageIcon;
import java.awt.Image;

/**
 * @author Jason Farrell
 * Utility class for transferring data to the Main Server from the GUI
 * 
 * TODO
 * Add serializable traits to the object
 *
 */
public class Command implements Serializable, Comparable
{
	public static final char PATH = 'p';

    public static final char STOP = 's';
    public static final char FWD  = 'f';
    public static final char BWD  = 'b';
    public static final char LFT  = 'l';
    public static final char RGT  = 'r';
    
    public static final char TURN = 't';
    public static final char GO   = 'g';
	
    private ImageIcon m_theImage = null;

    // getter
    public Image getImage() {
            return this.m_theImage.getImage();
    }

    // setter
    public void setImage( Image i ) {
            this.m_theImage = new ImageIcon(i);		// this might only get the reference, make sure we are actually storing the object
    }

    private Point m_thePoint = null;

    // getter
    public Point getPoint() {
            return this.m_thePoint;
    }

    // setter
    public void setPoint( Point p ) {
            this.m_thePoint = p;	// same issue here
    }

    private char cmd = '\0';
    // getter
    public char getCmd() {
            return this.cmd;
    }

    private int val = 0;
    // getter
    public int getVal() {
            return this.val;
    }

    public Command(char cmd, Image pImage, Point pPoint)
    {
            this.cmd = cmd;
            this.m_theImage = new ImageIcon( pImage );
            this.m_thePoint = pPoint;
    }
    
    public Command(char cmd, int val)
    {
        this.cmd=cmd;
        this.val=val;
    }
    
    public Command(char cmd)
    {
        this.cmd = cmd;
    }
    
    public int compareTo(Object c) {
        if(this.getCmd()=='s')
            return 1;
        else return 0;
    }
}